﻿<%@ Page Title="" Language="C#" MasterPageFile="~/PBOfficeMaster.master" AutoEventWireup="true"
    CodeFile="AddStaff.aspx.cs" Inherits="PersonalManager_AddStaff" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        function xmlCreate() {
            if (window.ActiveXObject) {
                return new ActiveXObject("Microsoft.XMLHTTP");
            }
            else { return new XMLHttpRequest(); }
        }
        window.onload = function () {
            var pos = document.getElementById("position");
            for (var i = 0; i < 8; i++) {
                pos.options.add(new Option("dd" + i, i));
            }
        }
        function OpenWin(txt, width, height) {
           
//            var me;
//            // 把父页面窗口对象当作参数传递到对话框中，以便对话框操纵父页自动刷新。 
//            me = window;
//            // 显示对话框。 
//            var a = window.showModalDialog("Tree.aspx", me, 'dialogWidth=' + width + 'px;dialogHeight=' + height + 'px;toolbar=0;scrollbars=0;location=0;status=0;menubar=0;resize=0;help:no;status:no')
//            if (typeof (a) != "undefined")

//            //返回值赋给TextBox
//                txt.value = a;
//            alert(a);
//            var dep = txt.value;
//            if (dep != null) {
//                var xmlRequest = xmlCreate();
//                xmlRequest.onreadystatechange = function () {
//                    if (xmlRequest.readystate == 4 && xmlRequest.status == 200) {

//                        var posi = eval("(" + xmlRequest.responseText + ")");
//                        var posi = document.getElementById("position");
//                        for (var i = 0; i < posi.length; i++) {
//                            posi.options.add(new Option(posi[i].PosName, posi[i].PosId));
//                        }
//                    }
//                }
//                //3,初始化XMLrequest
//                xmlRequest.open("POST", "DeptHandler.ashx", true);
//                xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
//                //4、发送请求
//                // xmlRequest.send();
//                var data = "deptname=" + dep;
//                xmlRequest.send(data);

//            }
        }

        function FillSuper(txt) {
            var content = txt.value;
            var xmlRequest = xmlCreate();
            xmlRequest.onreadystatechange = function () {
                if (xmlRequest.readystate == 4 && xmlRequest.status == 200) {
                    var staff = eval("(" + xmlRequest.responseText + ")");
                    var super1 = document.getElementsByName("select");
                    for (var i = 0; i < staff.length; i++) {
                        super1.options.add(new Option(staff[i].StfName, staff[i].StfId.String()));

                    }
                }
            }
            //3,初始化XMLrequest
            xmlRequest.open("POST", "SuperHandler.ashx", true);
            xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            //4、发送请求
            // xmlRequest.send();
            var data = "content=" + content;
            xmlRequest.send(data);
        }

//        $(
//                function () {
//                    $("#txtDept").click(function () {
//                        var dep = $("#txtDept").val();
//                        if (dep == null) {

//                            alert("部门为空！");
//                            return;
//                        }
//                        $.post("Dept.aspx", { dep: dep }, function (data) {
//                            if (data == "false") {
//                                alert("shibai");
//                            }
//                            else {
//                                var pos = $("#position");
//                                for (var i = 0; i < data.length; i++) {
//                                    pos.options.add(new Option(data[i].PosName, data[i].PosId.toString()));
//                                }
//                            }
//                        });
//                    }
//               );
//                }
//                );
    </script>
    <link type="text/css" rel="Stylesheet" href="../css/PersonalManagerCss.css" />
    <style type="text/css">
        .style1
        {
            width: 81px;
        }
        #ddlPosition
        {
            width: 127px;
        }
        #txtSuper
        {
            width: 91px;
        }
        #ddlSuper
        {
            width: 57px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 864px;">
        <div class="branchtop">
            <table>
                <tr>
                    <td>
                        当前位置
                    </td>
                    <td>
                        <div class="lbBranch">
                            创建员工</div>
                    </td>
                </tr>
            </table>
        </div>
        <hr />
        <div style="width: 680px; margin: 10px 60px; font-size: 12px; font-weight: bold;
            border: 1px solid #66ccfd; background-color: #f4fcfe;">
            <fieldset style="border: 1px solid #66ccfd; width: 678px; margin: 5px 1px;">
                <legend>基本信息</legend>
                <div style="float: left; width: 662px; margin: 3px;">
                    <div style="float: left;">
                        <table>
                            <tr>
                                <td style="padding: 0px 15px; text-align: right;">
                                    姓名:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    员工编号:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtCode" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    性别:
                                </td>
                                <td style="text-align: left;">
                                    <asp:RadioButton ID="rbMan" runat="server" GroupName="sex" Text="男" /><asp:RadioButton
                                        ID="rbWoman" runat="server" GroupName="sex" Text="女" />
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    部门:
                                </td>
                                <td>
                                    <input id="txtDept" type="text" runat="server" onclick="OpenWin(this,200,300);" />
                                    <%--<asp:TextBox ID="txtDept" runat="server"></asp:TextBox>--%>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    岗位:
                                </td>
                                <td style="text-align: left;">
                                    <select id="position" name="pos" datatextfield="PosName" datavaluefield="PosId" runat="server">
                                    </select>
                                    <%-- <asp:DropDownList ID="ddlPosition" Width="80px" runat="server">
                                </asp:DropDownList>--%>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    直接上级:
                                </td>
                                <td id="select" style="text-align: left;">
                                    <select id="ddlSuper" datatextfield="StfName" name="select" datavaluefield="StfId" runat="server">
                                    </select><input id="txtSuper" type="text" runat="server" onblur="FillSuper(this);" />
                                    <%-- <asp:DropDownList ID="ddlSuper" Width="100px" runat="server">
                                </asp:DropDownList>--%>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="float: right;">
                        <table>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    照片：
                                </td>
                                <td>
                                    <asp:FileUpload ID="FileUpload1" runat="server" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Image ID="Image1" runat="server" Height="127px" Width="93px" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </fieldset>
            <fieldset style="border: 1px solid #66ccfd; width: 678px; margin: 5px 1px;">
                <legend>扩展信息</legend>
                <div style="float: left; width: 674px;">
                    <div style="float: left;">
                        <table>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    教育程度:
                                </td>
                                <td style="text-align: left;">
                                    <asp:DropDownList ID="ddlEducation" Width="60px" runat="server">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    入职日期:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtJoinDate" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    出生日期:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtBornDate" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="float: right;">
                        <table>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;" class="style1">
                                    工作经历：
                                </td>
                                <td>
                                    <asp:TextBox ID="txtWorkExp" TextMode="MultiLine" Height="100px" Width="200px" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </fieldset>
            <fieldset style="border: 1px solid #66ccfd; width: 678px; margin: 5px 1px;">
                <legend>通讯录</legend>
                <div style="float: left; width: 668px; margin: 3px;">
                    <div style="float: left;">
                        <table>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    座机:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtTelephone" runat="server" Height="19px" Width="80px"></asp:TextBox>
                                    &nbsp;&nbsp;
                                    <asp:TextBox ID="txtTelephoneExp" runat="server" Height="19px" Width="40px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    联系地址:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    Email:
                                </td>
                                <td>
                                    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="float: right;">
                        <table style="width: 336px">
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    手机：
                                </td>
                                <td>
                                    <asp:TextBox ID="txtMobileTelNo" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 15px; text-align: right;">
                                    邮政编码：
                                </td>
                                <td>
                                    <asp:TextBox ID="txtZip" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </fieldset>
            <div>
                <asp:Button ID="btnSubmit" runat="server" CssClass="btnBranch" Text="提交" OnClick="btnSubmit_Click" />&nbsp;&nbsp;
                <asp:Button ID="btnCancle" runat="server" CssClass="btnBranch" Text="返回" OnClick="btnCancle_Click" />
            </div>
        </div>
    </div>
</asp:Content>
